/**
 * Created by JasonChou on 16/6/5.
 */


if (Vue) {
    Vue.filter('phone', {
        read: function (phone) {
            phone += '';

            var res = '';
            var count = 0;
            for (i = phone.length - 1; i >= 0; i--) {

                count++;

                res = phone.charAt(i) + res;

                if (count == 4) {
                    res = ' ' + res;
                    count = 0;
                }

            }

            return res;

        },
        write: function (phone) {
            return phone.replace(/' '/, '');
        }
    });
}